package written.test;


import java.util.Arrays;
import java.util.Scanner;

/**
 * @author dangqi
 * @date 2021/7/31 18:57
 */
public class YuanFuDao {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] tmp = sc.nextLine().split(" ");

        int[] nums = new int[tmp.length];
        for(int i = 0; i < tmp.length; i++){
            nums[i] = Integer.parseInt(tmp[i]);
        }
        int[] nums2 = nums.clone();
        Arrays.sort(nums);
        Integer a = null, b = null;
        for(int i = 0; i < tmp.length; i++){
            if(nums2[i] != nums[i]){
                if(a==null) a = i;
                else b = i;
            }
        }
        if(a==null) return;
        System.out.println((a+1) + " "+ (b+1));
    }
}
